/**
*	@class VertexFormat
*
*	@brief
*
*	@author William McVicar
*/

#pragma once

#ifndef __VERTEXFORMATBASE_H_INCLUDED__
#define __VERTEXFORMATBASE_H_INCLUDED__

//  Library Includes

//  Local Includes

//  Macros

//  Forward Declarations

//  Types
typedef enum
{
	ST_NONE,

	ST_POSITION,
	ST_COLOUR,
	ST_NORMAL,
	ST_TEXCOORD,

	ST_MAX

} eSemanticType;

typedef enum
{
    SF_NONE,
    SF_FLOAT1,
    SF_FLOAT2,
    SF_FLOAT3,
    SF_FLOAT4,
    SF_HALF1,
    SF_HALF2,
    SF_HALF3,
    SF_HALF4,
    SF_UBYTE4,
    SF_SHORT1,
    SF_SHORT2,
    SF_SHORT4,
    SF_QUANTITY

} eSemanticFormat;

typedef enum
{
	FL_MAX_ATTRIBUTES = 16
} eFormatLimits;

typedef struct tagVertexElement
{
	eSemanticType	eType;
	eSemanticFormat	eFormat;
	u32				uiInputElementSize;
	u32				uiOffset;

} tVertElem;

//  Constants

//  Prototypes

namespace Protein
{

class VertexFormatBase
{
	//Member Functions
public:

	virtual ~VertexFormatBase();

	inline u32 NumAttributes() const;
	inline u32 Stride() const;

	void SetElement( i32 _iElementIndex, u32 _uiOffset, eSemanticType _eType, eSemanticFormat _eFormat );
	void GetElement( i32 _iElementIndex, u32& _uiOffset, eSemanticType& _eType, eSemanticFormat& _eFormat ) const;

	static VertexFormatBase* Create( u32 _uiNumAttributes, ... );

protected: 

private: 

	VertexFormatBase( u32 );
	VertexFormatBase( const VertexFormatBase& ){}
	VertexFormatBase& operator=( const VertexFormatBase& ){}

	//Member Variables
public:

	static u32  sm_uiMaxNumAttributes;

protected: 

private: 

	u32			m_uiNumAttributes;
	u32			m_uiStride;
	tVertElem	m_VertElems[ FL_MAX_ATTRIBUTES ];		//allow up to 16 vertex attributes

	static i32	sm_iSemanticSize[ SF_QUANTITY ];

};

#include "VertexFormatBase.inl"

}

#endif //__VERTEXFORMATBASE_H_INCLUDED__
